package com.xique.park.api.factory;


import com.xique.common.core.web.domain.AjaxResult;
import com.xique.park.api.RemoteParkPayPpService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 日志服务降级处理
 *
 * @author xique
 */
@Component
public class RemoteParkPayPpFallbackFactory implements FallbackFactory<RemoteParkPayPpService>{

    private static final Logger log = LoggerFactory.getLogger(RemoteParkPayPpFallbackFactory.class);

    @Override
    public RemoteParkPayPpService create(Throwable throwable)
    {
        log.error("删除车场支付配置失败:{}", throwable.getMessage());
        return new RemoteParkPayPpService() {

            @Override
            public AjaxResult delete(Long parkId) {
                return AjaxResult.error("删除失败");
            }

            @Override
            public AjaxResult getParkPayPp(Long parkId) {
                return AjaxResult.error("查询支付配置失败");
            }
        };


    }
}
